@@ -48,7 +48,7 @@ client = RegistryAPIClient(
4848 connect_timeout = 10.0 ,
4949 read_timeout = 30.0 ,
5050 max_connections = 10 ,
51- max_keepalive_connections = 5
51+ max_keepalive_connections = 5 ,
5252)
5353```
5454
@@ -87,6 +87,7 @@ from agentconnect.index import RegistryAPIClient
8787from agentconnect.index.registry import AgentRegistration
8888from agentconnect.core import AgentType, InteractionMode, AgentIdentity, Capability
8989
90+
9091async def register_agent_example ():
9192 async with RegistryAPIClient() as client:
9293 # Create agent registration
@@ -98,19 +99,24 @@ async def register_agent_example():
9899 name = " Data Processor" ,
99100 summary = " Processes CSV and JSON data files" ,
100101 capabilities = [
101- Capability(name = " csv_processing" , description = " Parse and transform CSV files" ),
102- Capability(name = " json_processing" , description = " Parse and transform JSON data" )
102+ Capability(
103+ name = " csv_processing" , description = " Parse and transform CSV files"
104+ ),
105+ Capability(
106+ name = " json_processing" , description = " Parse and transform JSON data"
107+ ),
103108 ],
104- tags = [" data" , " processing" , " csv" , " json" ]
109+ tags = [" data" , " processing" , " csv" , " json" ],
105110 )
106-
111+
107112 # Register agent
108113 success = await client.register(agent)
109114 if success:
110115 print (f " Successfully registered { agent.agent_id} " )
111116 else :
112117 print (" Registration failed" )
113118
119+
114120# Run the example
115121asyncio.run(register_agent_example())
116122```
@@ -120,21 +126,21 @@ asyncio.run(register_agent_example())
120126``` python
121127async def discover_agents_example ():
122128 async with RegistryAPIClient() as client:
123-
124129 # Find agents using semantic search
125130 results = await client.get_by_capability_semantic(
126131 capability_description = " process data files and generate reports" ,
127132 limit = 5 ,
128133 similarity_threshold = 0.3 ,
129- filters = {" tags" : [" data" , " reporting" ]}
134+ filters = {" tags" : [" data" , " reporting" ]},
130135 )
131-
136+
132137 # Process results
133138 for agent_reg, score in results:
134139 print (f " Found: { agent_reg.name} (Score: { score:.3f } ) " )
135140 print (f " Capabilities: { [cap.name for cap in agent_reg.capabilities]} " )
136141 print (f " Tags: { agent_reg.tags} " )
137142
143+
138144asyncio.run(discover_agents_example())
139145```
140146
@@ -143,19 +149,21 @@ asyncio.run(discover_agents_example())
143149``` python
144150async def bulk_operations_example ():
145151 async with RegistryAPIClient() as client:
146-
147152 # Get all agents from a specific organization
148153 org_agents = await client.get_by_organization(" acme_corp" )
149154 print (f " Found { len (org_agents)} agents from Acme Corp " )
150-
155+
151156 # Get all verified agents
152157 verified = await client.get_verified_agents()
153158 print (f " Found { len (verified)} verified agents " )
154-
159+
155160 # Get agents by interaction mode
156- api_agents = await client.get_by_interaction_mode(InteractionMode.AGENT_TO_AGENT )
161+ api_agents = await client.get_by_interaction_mode(
162+ InteractionMode.AGENT_TO_AGENT
163+ )
157164 print (f " Found { len (api_agents)} A2A agents " )
158165
166+
159167asyncio.run(bulk_operations_example())
160168```
161169
@@ -167,20 +175,20 @@ The client includes comprehensive error handling:
167175async def error_handling_example ():
168176 try :
169177 async with RegistryAPIClient() as client:
170-
171178 # This will automatically retry on network errors
172179 result = await client.get_registration(" some_agent_id" )
173-
180+
174181 if result is None :
175182 print (" Agent not found (404)" )
176183 else :
177184 print (f " Found agent: { result.name} " )
178-
185+
179186 except httpx.RequestError as e:
180187 print (f " Network error after all retries: { e} " )
181188 except Exception as e:
182189 print (f " Unexpected error: { e} " )
183190
191+
184192asyncio.run(error_handling_example())
185193```
186194
@@ -211,16 +219,16 @@ The client uses `settings` from `agentconnect.config` and can be configured via
211219
212220``` python
213221# Client configuration (available via settings.clients.registry)
214- settings.clients.registry.base_url # Default: "http://localhost:8000"
215- settings.clients.registry.default_timeout # Default: 30.0
216- settings.clients.registry.connect_timeout # Default: 10.0
217- settings.clients.registry.read_timeout # Default: 30.0
218- settings.clients.registry.pool_timeout # Default: 5.0
219- settings.clients.registry.max_retries # Default: 3
220- settings.clients.registry.retry_backoff_factor # Default: 0.5
221- settings.clients.registry.retryable_status_codes # Default: [502, 503, 504]
222- settings.clients.registry.max_connections # Default: 10
223- settings.clients.registry.max_keepalive_connections # Default: 5
222+ settings.clients.registry.base_url # Default: "http://localhost:8000"
223+ settings.clients.registry.default_timeout # Default: 30.0
224+ settings.clients.registry.connect_timeout # Default: 10.0
225+ settings.clients.registry.read_timeout # Default: 30.0
226+ settings.clients.registry.pool_timeout # Default: 5.0
227+ settings.clients.registry.max_retries # Default: 3
228+ settings.clients.registry.retry_backoff_factor # Default: 0.5
229+ settings.clients.registry.retryable_status_codes # Default: [502, 503, 504]
230+ settings.clients.registry.max_connections # Default: 10
231+ settings.clients.registry.max_keepalive_connections # Default: 5
224232```
225233
226234Example ` agentconnect.yaml ` configuration:
@@ -288,6 +296,7 @@ Enable debug logging for detailed HTTP request/response information:
288296
289297` ` ` python
290298import logging
299+
291300logging.basicConfig(level=logging.DEBUG)
292301
293302# Will show detailed HTTP logs
0 commit comments