aigency 0.0.1rc225507851__tar.gz → 0.0.1rc235167702__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/PKG-INFO +1 -1
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/aigency/agents/generator.py +21 -19
- aigency-0.0.1rc235167702/aigency/schemas/agent/agent.py +12 -0
- aigency-0.0.1rc235167702/aigency/schemas/agent/model.py +12 -0
- aigency-0.0.1rc235167702/aigency/schemas/agent/skills.py +10 -0
- aigency-0.0.1rc235167702/aigency/schemas/aigency_config.py +14 -0
- aigency-0.0.1rc235167702/aigency/schemas/metadata/metadata.py +8 -0
- aigency-0.0.1rc235167702/aigency/schemas/observability/observability.py +10 -0
- aigency-0.0.1rc235167702/aigency/schemas/observability/phoenix.py +6 -0
- aigency-0.0.1rc235167702/aigency/schemas/service/capabilities.py +5 -0
- aigency-0.0.1rc235167702/aigency/schemas/service/interface.py +7 -0
- aigency-0.0.1rc235167702/aigency/schemas/service/service.py +9 -0
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/aigency/tools/generator.py +3 -7
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/aigency/utils/config_service.py +38 -17
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/aigency.egg-info/PKG-INFO +1 -1
- aigency-0.0.1rc235167702/aigency.egg-info/SOURCES.txt +26 -0
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/pyproject.toml +1 -1
- aigency-0.0.1rc225507851/aigency/models/config.py +0 -69
- aigency-0.0.1rc225507851/aigency/models/core.py +0 -28
- aigency-0.0.1rc225507851/aigency.egg-info/SOURCES.txt +0 -18
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/README.md +0 -0
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/aigency/__init__.py +0 -0
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/aigency/agents/executor.py +0 -0
- {aigency-0.0.1rc225507851/aigency/models → aigency-0.0.1rc235167702/aigency/schemas/agent}/tools.py +0 -0
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/aigency/utils/logger.py +0 -0
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/aigency/utils/singleton.py +0 -0
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/aigency/utils/utils.py +0 -0
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/aigency.egg-info/dependency_links.txt +0 -0
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/aigency.egg-info/requires.txt +0 -0
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/aigency.egg-info/top_level.txt +0 -0
- {aigency-0.0.1rc225507851 → aigency-0.0.1rc235167702}/setup.cfg +0 -0
@@ -10,7 +10,7 @@ from google.adk.runners import Runner
|
|
10
10
|
from google.adk.sessions import InMemorySessionService
|
11
11
|
|
12
12
|
from aigency.agents.executor import AgentA2AExecutor
|
13
|
-
from aigency.
|
13
|
+
from aigency.schemas.aigency_config import AigencyConfig
|
14
14
|
from aigency.tools.generator import ToolGenerator
|
15
15
|
|
16
16
|
|
@@ -18,22 +18,26 @@ class AgentA2AGenerator:
|
|
18
18
|
"""Generator for creating A2A agents and related components."""
|
19
19
|
|
20
20
|
@staticmethod
|
21
|
-
def create_agent(agent_config:
|
21
|
+
def create_agent(agent_config: AigencyConfig) -> Agent:
|
22
|
+
|
23
|
+
tools = [
|
24
|
+
ToolGenerator.create_tool(tool_cfg) for tool_cfg in agent_config.agent.tools
|
25
|
+
]
|
22
26
|
|
23
|
-
tools = [ToolGenerator.create_tool(tool_cfg) for tool_cfg in agent_config.tools]
|
24
|
-
|
25
27
|
return Agent(
|
26
|
-
name=agent_config.name,
|
27
|
-
model=agent_config.model.name,
|
28
|
-
instruction=agent_config.instruction,
|
28
|
+
name=agent_config.metadata.name,
|
29
|
+
model=agent_config.agent.model.name,
|
30
|
+
instruction=agent_config.agent.instruction,
|
29
31
|
tools=tools,
|
30
32
|
)
|
31
33
|
|
32
34
|
@staticmethod
|
33
|
-
def build_agent_card(agent_config:
|
35
|
+
def build_agent_card(agent_config: AigencyConfig) -> AgentCard:
|
34
36
|
|
35
37
|
# TODO: Parse properly
|
36
|
-
capabilities = AgentCapabilities(
|
38
|
+
capabilities = AgentCapabilities(
|
39
|
+
streaming=agent_config.service.capabilities.streaming
|
40
|
+
)
|
37
41
|
|
38
42
|
skills = [
|
39
43
|
AgentSkill(
|
@@ -43,24 +47,22 @@ class AgentA2AGenerator:
|
|
43
47
|
tags=skill.tags,
|
44
48
|
examples=skill.examples,
|
45
49
|
)
|
46
|
-
for skill in agent_config.skills
|
50
|
+
for skill in agent_config.agent.skills
|
47
51
|
]
|
48
52
|
|
49
53
|
return AgentCard(
|
50
|
-
name=agent_config.name,
|
51
|
-
description=agent_config.description,
|
52
|
-
url=agent_config.url,
|
53
|
-
version=agent_config.version,
|
54
|
-
default_input_modes=agent_config.default_input_modes,
|
55
|
-
default_output_modes=agent_config.default_output_modes,
|
54
|
+
name=agent_config.metadata.name,
|
55
|
+
description=agent_config.metadata.description,
|
56
|
+
url=agent_config.service.url,
|
57
|
+
version=agent_config.metadata.version,
|
58
|
+
default_input_modes=agent_config.service.interface.default_input_modes,
|
59
|
+
default_output_modes=agent_config.service.interface.default_output_modes,
|
56
60
|
capabilities=capabilities,
|
57
61
|
skills=skills,
|
58
62
|
)
|
59
63
|
|
60
64
|
@staticmethod
|
61
|
-
def build_executor(
|
62
|
-
agent: Agent, agent_card: AgentCard
|
63
|
-
) -> AgentA2AExecutor:
|
65
|
+
def build_executor(agent: Agent, agent_card: AgentCard) -> AgentA2AExecutor:
|
64
66
|
|
65
67
|
runner = Runner(
|
66
68
|
app_name=agent.name,
|
@@ -0,0 +1,12 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
from typing import List, Optional
|
3
|
+
from aigency.schemas.agent.model import AgentModel
|
4
|
+
from aigency.schemas.agent.skills import Skill
|
5
|
+
from aigency.schemas.agent.tools import FunctionTool, McpTool
|
6
|
+
|
7
|
+
class Agent(BaseModel):
|
8
|
+
"""El 'cerebro' del agente: su lógica, modelo y capacidades."""
|
9
|
+
model: AgentModel
|
10
|
+
instruction: str
|
11
|
+
skills: List[Skill]
|
12
|
+
tools: Optional[List[FunctionTool | McpTool]] = []
|
@@ -0,0 +1,12 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
from pydantic import BaseModel
|
3
|
+
|
4
|
+
class ProviderConfig(BaseModel):
|
5
|
+
"""Configuration for AI model provider."""
|
6
|
+
name: str
|
7
|
+
endpoint: Optional[str] = None
|
8
|
+
|
9
|
+
class AgentModel(BaseModel):
|
10
|
+
"""Configuration for AI model."""
|
11
|
+
name: str
|
12
|
+
provider: Optional[ProviderConfig] = None
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
from typing import Optional
|
3
|
+
from aigency.schemas.observability.observability import Observability
|
4
|
+
from aigency.schemas.metadata.metadata import Metadata
|
5
|
+
from aigency.schemas.agent.agent import Agent
|
6
|
+
from aigency.schemas.service.service import Service
|
7
|
+
|
8
|
+
class AigencyConfig(BaseModel):
|
9
|
+
"""Root Pydantic model for complete agent configuration."""
|
10
|
+
|
11
|
+
metadata: Metadata
|
12
|
+
service: Service
|
13
|
+
agent: Agent
|
14
|
+
observability: Optional[Observability] = None
|
@@ -0,0 +1,10 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
from aigency.schemas.observability.phoenix import Phoenix
|
3
|
+
|
4
|
+
class Monitoring(BaseModel):
|
5
|
+
"""Configuración de las herramientas de monitoreo."""
|
6
|
+
phoenix: Phoenix
|
7
|
+
|
8
|
+
class Observability(BaseModel):
|
9
|
+
"""Agrupa todas las configuraciones de observabilidad."""
|
10
|
+
monitoring: Monitoring
|
@@ -0,0 +1,9 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
from aigency.schemas.service.interface import Interface
|
3
|
+
from aigency.schemas.service.capabilities import Capabilities
|
4
|
+
|
5
|
+
class Service(BaseModel):
|
6
|
+
"""Configuración de red y comunicación del agente."""
|
7
|
+
url: str
|
8
|
+
interface: Interface
|
9
|
+
capabilities: Capabilities
|
@@ -14,7 +14,7 @@ from google.adk.tools.mcp_tool.mcp_toolset import (
|
|
14
14
|
StreamableHTTPConnectionParams,
|
15
15
|
)
|
16
16
|
|
17
|
-
from aigency.
|
17
|
+
from aigency.schemas.agent.tools import (
|
18
18
|
FunctionTool,
|
19
19
|
McpTool,
|
20
20
|
McpTypeStdio,
|
@@ -43,11 +43,7 @@ class ToolGenerator:
|
|
43
43
|
|
44
44
|
if isinstance(config.mcp_config, McpTypeStreamable):
|
45
45
|
url = f"http://{config.mcp_config.url}:{config.mcp_config.port}{config.mcp_config.path}"
|
46
|
-
return MCPToolset(
|
47
|
-
connection_params=StreamableHTTPConnectionParams(
|
48
|
-
url=url
|
49
|
-
)
|
50
|
-
)
|
46
|
+
return MCPToolset(connection_params=StreamableHTTPConnectionParams(url=url))
|
51
47
|
elif isinstance(config.mcp_config, McpTypeStdio):
|
52
48
|
command = config.mcp_config.command
|
53
49
|
args = config.mcp_config.args
|
@@ -65,7 +61,7 @@ class ToolGenerator:
|
|
65
61
|
ToolType.MCP: load_mcp_tool,
|
66
62
|
ToolType.FUNCTION: load_function_tool,
|
67
63
|
}
|
68
|
-
|
64
|
+
|
69
65
|
@staticmethod
|
70
66
|
def create_tool(tool: Tool) -> Optional[Any]:
|
71
67
|
"""Create a tool based on its configuration.
|
@@ -6,36 +6,46 @@ from typing import Any, Dict, Optional
|
|
6
6
|
|
7
7
|
import yaml
|
8
8
|
|
9
|
-
from aigency.
|
9
|
+
from aigency.schemas.aigency_config import AigencyConfig
|
10
10
|
from aigency.utils.logger import get_logger
|
11
11
|
|
12
12
|
|
13
13
|
logger = get_logger()
|
14
14
|
|
15
|
+
|
15
16
|
class ConfigService:
|
16
17
|
"""Service for loading and managing agent configurations."""
|
18
|
+
|
17
19
|
def __init__(self, config_file: str, environment: Optional[str] = None):
|
18
20
|
self.config_file = config_file
|
19
|
-
self.environment = environment or os.getenv(
|
21
|
+
self.environment = environment or os.getenv("ENVIRONMENT", None)
|
20
22
|
self.config = self._load_and_parse()
|
21
23
|
|
22
|
-
def _load_and_parse(self) ->
|
23
|
-
"""Carga los YAMLs, los mergea y parsea según
|
24
|
+
def _load_and_parse(self) -> AigencyConfig:
|
25
|
+
"""Carga los YAMLs, los mergea y parsea según AigencyConfig."""
|
24
26
|
|
25
27
|
logger.info(f"Loading configuration from {self.config_file}")
|
26
28
|
config = self._load_yaml(self.config_file)
|
27
29
|
|
28
30
|
if self.environment is not None:
|
29
|
-
logger.info(
|
31
|
+
logger.info(
|
32
|
+
f"Environment '{self.environment}' detected, loading environment-specific configuration"
|
33
|
+
)
|
30
34
|
env_config = self._load_env_config()
|
31
35
|
if env_config:
|
32
|
-
logger.info(
|
36
|
+
logger.info(
|
37
|
+
f"Successfully loaded environment configuration with {len(env_config)} keys: {list(env_config.keys())}"
|
38
|
+
)
|
33
39
|
config = self._merge_configs(config, env_config)
|
34
|
-
logger.debug(
|
40
|
+
logger.debug(
|
41
|
+
f"Configuration merged successfully for environment '{self.environment}'"
|
42
|
+
)
|
35
43
|
else:
|
36
|
-
logger.warning(
|
37
|
-
|
38
|
-
|
44
|
+
logger.warning(
|
45
|
+
f"No environment-specific configuration found for '{self.environment}', using base configuration only"
|
46
|
+
)
|
47
|
+
|
48
|
+
return AigencyConfig(**config)
|
39
49
|
|
40
50
|
def _load_yaml(self, file_path: str) -> Dict[str, Any]:
|
41
51
|
"""Carga un archivo YAML."""
|
@@ -43,26 +53,37 @@ class ConfigService:
|
|
43
53
|
with open(file_path, "r", encoding="utf-8") as file:
|
44
54
|
return yaml.safe_load(file) or {}
|
45
55
|
except FileNotFoundError:
|
46
|
-
raise FileNotFoundError(
|
56
|
+
raise FileNotFoundError(
|
57
|
+
f"Archivo de configuración no encontrado: {file_path}"
|
58
|
+
)
|
47
59
|
except yaml.YAMLError as e:
|
48
60
|
raise ValueError(f"Error al parsear YAML {file_path}: {e}")
|
49
61
|
|
50
62
|
def _load_env_config(self) -> Optional[Dict[str, Any]]:
|
51
63
|
"""Carga configuración específica del entorno."""
|
52
64
|
config_path = Path(self.config_file)
|
53
|
-
env_file =
|
54
|
-
|
65
|
+
env_file = (
|
66
|
+
config_path.parent
|
67
|
+
/ f"{config_path.stem}.{self.environment}{config_path.suffix}"
|
68
|
+
)
|
69
|
+
|
55
70
|
return self._load_yaml(str(env_file)) if env_file.exists() else None
|
56
71
|
|
57
|
-
def _merge_configs(
|
72
|
+
def _merge_configs(
|
73
|
+
self, base: Dict[str, Any], env: Optional[Dict[str, Any]]
|
74
|
+
) -> Dict[str, Any]:
|
58
75
|
"""Mergea configuración base con configuración de entorno."""
|
59
76
|
if not env:
|
60
77
|
return base
|
61
|
-
|
78
|
+
|
62
79
|
result = base.copy()
|
63
80
|
for key, value in env.items():
|
64
|
-
if
|
81
|
+
if (
|
82
|
+
key in result
|
83
|
+
and isinstance(result[key], dict)
|
84
|
+
and isinstance(value, dict)
|
85
|
+
):
|
65
86
|
result[key] = self._merge_configs(result[key], value)
|
66
87
|
else:
|
67
88
|
result[key] = value
|
68
|
-
return result
|
89
|
+
return result
|
@@ -0,0 +1,26 @@
|
|
1
|
+
README.md
|
2
|
+
pyproject.toml
|
3
|
+
aigency/__init__.py
|
4
|
+
aigency.egg-info/PKG-INFO
|
5
|
+
aigency.egg-info/SOURCES.txt
|
6
|
+
aigency.egg-info/dependency_links.txt
|
7
|
+
aigency.egg-info/requires.txt
|
8
|
+
aigency.egg-info/top_level.txt
|
9
|
+
aigency/agents/executor.py
|
10
|
+
aigency/agents/generator.py
|
11
|
+
aigency/schemas/aigency_config.py
|
12
|
+
aigency/schemas/agent/agent.py
|
13
|
+
aigency/schemas/agent/model.py
|
14
|
+
aigency/schemas/agent/skills.py
|
15
|
+
aigency/schemas/agent/tools.py
|
16
|
+
aigency/schemas/metadata/metadata.py
|
17
|
+
aigency/schemas/observability/observability.py
|
18
|
+
aigency/schemas/observability/phoenix.py
|
19
|
+
aigency/schemas/service/capabilities.py
|
20
|
+
aigency/schemas/service/interface.py
|
21
|
+
aigency/schemas/service/service.py
|
22
|
+
aigency/tools/generator.py
|
23
|
+
aigency/utils/config_service.py
|
24
|
+
aigency/utils/logger.py
|
25
|
+
aigency/utils/singleton.py
|
26
|
+
aigency/utils/utils.py
|
@@ -1,69 +0,0 @@
|
|
1
|
-
"""Configuration models for agents."""
|
2
|
-
|
3
|
-
from typing import List, Optional, Union
|
4
|
-
|
5
|
-
from pydantic import BaseModel
|
6
|
-
|
7
|
-
from aigency.models.core import Capabilities, ModelConfig, Skill
|
8
|
-
from aigency.models.tools import FunctionTool, McpTool, Tool
|
9
|
-
|
10
|
-
#class SecurityScheme(BaseModel):
|
11
|
-
# """Define un esquema de seguridad individual."""
|
12
|
-
# type: str
|
13
|
-
# description: Optional[str] = None
|
14
|
-
# scheme: str
|
15
|
-
# bearerFormat: Optional[str] = None
|
16
|
-
#
|
17
|
-
#class AuthConfig(BaseModel):
|
18
|
-
# """Configuración de autenticación."""
|
19
|
-
# type: str
|
20
|
-
# securitySchemes: Optional[Dict[str, SecurityScheme]] = None
|
21
|
-
# security: Optional[List[Dict[str, List[str]]]] = None
|
22
|
-
|
23
|
-
# --- Modelos para secciones opcionales ---
|
24
|
-
|
25
|
-
#class MonitoringConfig(BaseModel):
|
26
|
-
# """Configuración de monitorización y observabilidad."""
|
27
|
-
# phoenix_host: Optional[str] = None
|
28
|
-
# phoenix_port: Optional[int] = None
|
29
|
-
|
30
|
-
#class RemoteAgent(BaseModel):
|
31
|
-
# """Configuración para la comunicación con un agente remoto."""
|
32
|
-
# name: str
|
33
|
-
# host: str
|
34
|
-
# port: int
|
35
|
-
#auth: Optional[AuthConfig] = None # Reutilizamos la configuración de Auth
|
36
|
-
|
37
|
-
# --- Clase Principal que une todo ---
|
38
|
-
|
39
|
-
class AgentConfig(BaseModel):
|
40
|
-
"""Root Pydantic model for complete agent configuration."""
|
41
|
-
# Configuración Básica
|
42
|
-
name: str
|
43
|
-
description: str
|
44
|
-
url: str
|
45
|
-
version: str
|
46
|
-
default_input_modes: Optional[List[str]] = None
|
47
|
-
default_output_modes: Optional[List[str]] = None
|
48
|
-
capabilities: Optional[Capabilities] = None
|
49
|
-
|
50
|
-
# Autenticación
|
51
|
-
#auth: Optional[AuthConfig] = None
|
52
|
-
|
53
|
-
# Configuración del Modelo
|
54
|
-
model: ModelConfig
|
55
|
-
|
56
|
-
# Comportamiento
|
57
|
-
instruction: Optional[str] = None
|
58
|
-
skills: Optional[List[Skill]] = None
|
59
|
-
|
60
|
-
# Herramientas
|
61
|
-
tools: Optional[List[Union[FunctionTool, McpTool, Tool]]] = None
|
62
|
-
|
63
|
-
# Comunicación Multi-Agente
|
64
|
-
#remote_agents_addresses: Optional[List[RemoteAgent]] = None
|
65
|
-
|
66
|
-
# Monitorización
|
67
|
-
#monitoring: Optional[MonitoringConfig] = None
|
68
|
-
|
69
|
-
|
@@ -1,28 +0,0 @@
|
|
1
|
-
"""Core models for agent configuration."""
|
2
|
-
|
3
|
-
from typing import Dict, List, Optional
|
4
|
-
|
5
|
-
from pydantic import BaseModel
|
6
|
-
|
7
|
-
|
8
|
-
class ProviderConfig(BaseModel):
|
9
|
-
"""Configuration for AI model provider."""
|
10
|
-
name: str
|
11
|
-
endpoint: Optional[str] = None
|
12
|
-
|
13
|
-
class ModelConfig(BaseModel):
|
14
|
-
"""Configuration for AI model."""
|
15
|
-
name: str
|
16
|
-
provider: Optional[ProviderConfig] = None
|
17
|
-
|
18
|
-
class Capabilities(BaseModel):
|
19
|
-
"""Agent capabilities, such as streaming."""
|
20
|
-
streaming: Optional[bool] = None
|
21
|
-
|
22
|
-
class Skill(BaseModel):
|
23
|
-
"""Define a specific agent skill."""
|
24
|
-
id: str
|
25
|
-
name: str
|
26
|
-
description: str
|
27
|
-
tags: Optional[List[str]] = None
|
28
|
-
examples: Optional[List[str]] = None
|
@@ -1,18 +0,0 @@
|
|
1
|
-
README.md
|
2
|
-
pyproject.toml
|
3
|
-
aigency/__init__.py
|
4
|
-
aigency.egg-info/PKG-INFO
|
5
|
-
aigency.egg-info/SOURCES.txt
|
6
|
-
aigency.egg-info/dependency_links.txt
|
7
|
-
aigency.egg-info/requires.txt
|
8
|
-
aigency.egg-info/top_level.txt
|
9
|
-
aigency/agents/executor.py
|
10
|
-
aigency/agents/generator.py
|
11
|
-
aigency/models/config.py
|
12
|
-
aigency/models/core.py
|
13
|
-
aigency/models/tools.py
|
14
|
-
aigency/tools/generator.py
|
15
|
-
aigency/utils/config_service.py
|
16
|
-
aigency/utils/logger.py
|
17
|
-
aigency/utils/singleton.py
|
18
|
-
aigency/utils/utils.py
|
File without changes
|
File without changes
|
File without changes
|
{aigency-0.0.1rc225507851/aigency/models → aigency-0.0.1rc235167702/aigency/schemas/agent}/tools.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|