Chuyển tới nội dung chính

Type Definitions

All types are Pydantic BaseModel subclasses, providing automatic validation, serialization, and IDE completion.

from faos import ShortcutResolution, ShortcutDefinition, AgentResponse

AgentResponse

Response from an agent invocation.

class AgentResponse(BaseModel):
content: str
agent_id: str
metadata: dict[str, Any]
FieldTypeDescription
contentstrThe agent's response text
agent_idstrID of the agent that responded
metadatadict[str, Any]Additional response metadata
response = await client.shortcut("bank credit-analyst")
print(response.content) # Agent's text output
print(response.agent_id) # e.g., "agent_abc123"
print(response.metadata) # e.g., {"tokens_used": 1500}

ShortcutResolution

Result of resolving a shortcut command to an agent.

class ShortcutResolution(BaseModel):
resolved: bool
agent_id: str | None
module_key: str | None
module_name: str | None
agent_name: str | None
task_template: str | None
capabilities: list[str]
suggestions: list[str]
FieldTypeDescription
resolvedboolWhether the shortcut was resolved
agent_idstr | NoneResolved agent ID
module_keystr | NoneModule key (e.g., "faos-bank")
module_namestr | NoneModule display name
agent_namestr | NoneAgent display name
task_templatestr | NoneDefault task template for agent
capabilitieslist[str]Agent capabilities
suggestionslist[str]Suggested shortcuts if unresolved
resolution = await client.shortcuts.resolve("bank credit-analyst")
if resolution.resolved:
print(resolution.agent_name) # "Credit Risk Analyst"
print(resolution.module_name) # "Banking & Finance"
print(resolution.capabilities) # ["credit_analysis", "risk_assessment"]

ShortcutDefinition

Definition of an available shortcut.

class ShortcutDefinition(BaseModel):
pattern: str
type: Literal["module", "agent", "command"]
description: str
module_key: str
agent_id: str | None
examples: list[str]
FieldTypeDescription
patternstrShortcut pattern (e.g., "bank credit-analyst")
type"module" | "agent" | "command"Shortcut type
descriptionstrHuman-readable description
module_keystrModule key
agent_idstr | NoneAgent ID if agent-level shortcut
exampleslist[str]Usage examples
shortcuts = await client.shortcuts.list(module="faos-bank")
for s in shortcuts:
print(f"{s.pattern} ({s.type}): {s.description}")