Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .claude/settings.local.json

This file was deleted.

9 changes: 5 additions & 4 deletions python/agent_runtime/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@dataclass
class Observation:
"""Represents an agent's observation of the world."""

timestamp: datetime
data: Dict[str, Any]
source: str = "world"
Expand All @@ -21,6 +22,7 @@ class Observation:
@dataclass
class Action:
"""Represents an action the agent wants to take."""

tool_name: str
parameters: Dict[str, Any]
reasoning: Optional[str] = None
Expand All @@ -29,6 +31,7 @@ class Action:
@dataclass
class AgentState:
"""Internal state of an agent."""

agent_id: str
goals: List[str] = field(default_factory=list)
observations: List[Observation] = field(default_factory=list)
Expand Down Expand Up @@ -87,7 +90,7 @@ def perceive(self, observation: Dict[str, Any], source: str = "world") -> None:

# Keep only recent observations to manage memory
if len(self.state.observations) > self.memory_capacity:
self.state.observations = self.state.observations[-self.memory_capacity:]
self.state.observations = self.state.observations[-self.memory_capacity :]

logger.debug(f"Agent {self.state.agent_id} received observation from {source}")

Expand All @@ -113,9 +116,7 @@ def decide_action(self) -> Optional[Action]:

if action:
self.state.action_history.append(action)
logger.info(
f"Agent {self.state.agent_id} decided action: {action.tool_name}"
)
logger.info(f"Agent {self.state.agent_id} decided action: {action.tool_name}")

return action

Expand Down
15 changes: 9 additions & 6 deletions python/agent_runtime/tool_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@dataclass
class ToolSchema:
"""Schema definition for a tool."""

name: str
description: str
parameters: Dict[str, Any] # JSON schema for parameters
Expand Down Expand Up @@ -154,11 +155,13 @@ def export_schemas_json(self) -> str:
"""
schemas = []
for schema in self.schemas.values():
schemas.append({
"name": schema.name,
"description": schema.description,
"parameters": schema.parameters,
"returns": schema.returns,
})
schemas.append(
{
"name": schema.name,
"description": schema.description,
"parameters": schema.parameters,
"returns": schema.returns,
}
)

return json.dumps(schemas, indent=2)
2 changes: 2 additions & 0 deletions python/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@dataclass
class BackendConfig:
"""Configuration for LLM backend."""

model_path: str
temperature: float = 0.7
max_tokens: int = 512
Expand All @@ -20,6 +21,7 @@ class BackendConfig:
@dataclass
class GenerationResult:
"""Result from LLM generation."""

text: str
tokens_used: int
finish_reason: str # "stop", "length", "error"
Expand Down
4 changes: 3 additions & 1 deletion python/backends/llama_cpp_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def _load_model(self) -> None:
logger.info("Model loaded successfully")

except ImportError:
logger.error("llama-cpp-python not installed. Install with: pip install llama-cpp-python")
logger.error(
"llama-cpp-python not installed. Install with: pip install llama-cpp-python"
)
raise
except Exception as e:
logger.error(f"Failed to load model: {e}")
Expand Down
Loading