File tree Expand file tree Collapse file tree 7 files changed +44
-8
lines changed
Expand file tree Collapse file tree 7 files changed +44
-8
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ async def handle_send_message(request_body: SendMessageRequest) -> SendMessageRe
147147 if part .kind == "text" :
148148 user_message += part .text
149149
150- kit = FlareAIKit ()
150+ kit = FlareAIKit (config = None ) # Use default settings
151151 deps = AgentDependencies (flare_kit = kit )
152152
153153 result = await price_agent .run (user_message , deps = deps )
Original file line number Diff line number Diff line change 11import asyncio
22import os
3+ from pathlib import Path
34from uuid import uuid4
45
56import structlog
1617 SendMessageRequest ,
1718 TextPart ,
1819)
20+ from flare_ai_kit .a2a .settings import A2ASettings
1921
2022load_dotenv ()
2123
@@ -184,7 +186,8 @@ async def route_workflow(
184186
185187 async def main () -> None :
186188 """Async entrypoint for orchestrator agent."""
187- client = A2AClient (db_path = "orchestrator-agent-client.db" )
189+ settings = A2ASettings (sqlite_db_path = Path ("orchestrator-agent.db" ))
190+ client = A2AClient (settings = settings )
188191
189192 await client .discover (
190193 [
Original file line number Diff line number Diff line change 11import asyncio
2+ from pathlib import Path
23
34from flare_ai_kit .a2a import A2AClient
45from flare_ai_kit .a2a .schemas import (
78 SendMessageRequest ,
89 TextPart ,
910)
11+ from flare_ai_kit .a2a .settings import A2ASettings
1012
1113
1214async def main () -> None :
@@ -15,7 +17,8 @@ async def main() -> None:
1517 "https://system-integration.telex.im/ping_pong_agent/.well-known/agent.json"
1618 )
1719 agent_base_url = agent_card_url .split (".well-known" )[0 ]
18- client = A2AClient (db_path = "tasks.db" )
20+ settings = A2ASettings (sqlite_db_path = Path ("tasks.db" ))
21+ client = A2AClient (settings = settings )
1922
2023 message = SendMessageRequest (
2124 params = MessageSendParams (
Original file line number Diff line number Diff line change 1717from flare_ai_kit .a2a .task_management import TaskManager
1818from flare_ai_kit .common import A2AClientError
1919
20+ from .settings import A2ASettings
21+
2022if TYPE_CHECKING :
2123 from collections .abc import Coroutine
2224
@@ -31,16 +33,17 @@ class A2AClient:
3133 3. performing task management,
3234 """
3335
34- def __init__ (self , db_path : str = "." , http_client_timeout : float = 30.0 ) -> None :
36+ def __init__ (self , settings : A2ASettings ) -> None :
3537 """Initialize the A2A client with SQLite database for task tracking."""
36- self .db_path = db_path
37- self .task_manager = TaskManager (db_path )
38+ self .sqlite_db_path = settings .sqlite_db_path
39+ self .client_timeout = settings .client_timeout
40+ self .task_manager = TaskManager (self .sqlite_db_path )
3841 self .agent_cards : dict [str , AgentCard ] = {}
3942 self .available_skills : list [AgentSkill ] = []
4043 self .skill_to_agents : dict [
4144 str , list [str ]
4245 ] = {} # skill name -> list of agent URLs
43- self .http_client = httpx .AsyncClient (timeout = http_client_timeout )
46+ self .http_client = httpx .AsyncClient (timeout = self . client_timeout )
4447
4548 async def send_message (
4649 self ,
Original file line number Diff line number Diff line change 1+ """Settings for A2A."""
2+
3+ from pathlib import Path
4+
5+ from pydantic import Field
6+ from pydantic_settings import BaseSettings , SettingsConfigDict
7+
8+
9+ class A2ASettings (BaseSettings ):
10+ """Configuration specific to the Flare ecosystem interactions."""
11+
12+ model_config = SettingsConfigDict (
13+ env_prefix = "A2A__" ,
14+ env_file = ".env" ,
15+ extra = "ignore" ,
16+ )
17+ sqlite_db_path : Path = Field (
18+ default = Path .cwd () / "flare_a2a.db" ,
19+ description = "Use a pregenerated attestation token for testing." ,
20+ )
21+ client_timeout : float = Field (
22+ default = 30.0 ,
23+ description = "Timeout for HTTP requests to A2A servers." ,
24+ )
Original file line number Diff line number Diff line change 77
88import sqlite3
99import uuid
10+ from pathlib import Path
1011from typing import ClassVar
1112
1213from flare_ai_kit .a2a .schemas import Task , TaskState , TaskStatus
@@ -23,7 +24,7 @@ class TaskManager:
2324 TaskState .unknown ,
2425 ]
2526
26- def __init__ (self , db_path : str = "tasks .db" ) -> None :
27+ def __init__ (self , db_path : Path = Path ( "flare_a2a .db") ) -> None :
2728 """Init method for the task manager."""
2829 self .db_path = db_path
2930 self .connection = sqlite3 .connect (db_path )
Original file line number Diff line number Diff line change 55from pydantic import Field
66from pydantic_settings import BaseSettings , SettingsConfigDict
77
8+ from flare_ai_kit .a2a .settings import A2ASettings
89from flare_ai_kit .agent .settings import AgentSettings
910from flare_ai_kit .ecosystem .settings import EcosystemSettings
1011from flare_ai_kit .ingestion .settings import IngestionSettings
@@ -36,3 +37,4 @@ class AppSettings(BaseSettings):
3637 social : SocialSettings = Field (default_factory = SocialSettings ) # pyright: ignore[reportArgumentType,reportUnknownVariableType]
3738 tee : TeeSettings = Field (default_factory = TeeSettings ) # pyright: ignore[reportArgumentType,reportUnknownVariableType]
3839 ingestion : IngestionSettings = Field (default_factory = IngestionSettings ) # pyright: ignore[reportArgumentType,reportUnknownVariableType]
40+ a2a : A2ASettings = Field (default_factory = A2ASettings ) # pyright: ignore[reportArgumentType,reportUnknownVariableType]
You can’t perform that action at this time.
0 commit comments