gunn.adapters.web package¶
Submodules¶
gunn.adapters.web.cli module¶
CLI for running the Web adapter server.
This module provides a command-line interface for starting the FastAPI-based Web adapter server with configurable options.
- class gunn.adapters.web.cli.AuthTokenConfig(**data)[ソース]¶
ベースクラス:
BaseModel
Configuration for authentication tokens.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gunn.adapters.web.cli.WebServerConfig(**data)[ソース]¶
ベースクラス:
BaseModel
Configuration for the web server.
- パラメータ:
-
auth_tokens:
list
[AuthTokenConfig
]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
gunn.adapters.web.health module¶
Health check endpoints for web adapter.
- gunn.adapters.web.health.setup_health_checker(config)[ソース]¶
Setup global health checker instance.
- 戻り値の型:
- パラメータ:
config (HealthCheckConfig)
gunn.adapters.web.server module¶
FastAPI-based Web adapter for external system integration.
This module provides REST and WebSocket endpoints for external systems to interact with the multi-agent simulation core, including authentication, authorization, and rate limiting.
Requirements addressed: - 8.3: Expose REST/WebSocket endpoints for external system integration - 12.1: Authenticate using token-based auth and authorize per agent_id/world_id - 12.4: Enforce rate limiting per tenant and agent
- class gunn.adapters.web.server.AuthToken(**data)[ソース]¶
ベースクラス:
BaseModel
Authentication token with permissions.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gunn.adapters.web.server.IntentRequest(**data)[ソース]¶
ベースクラス:
BaseModel
Request model for intent submission.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gunn.adapters.web.server.IntentResponse(**data)[ソース]¶
ベースクラス:
BaseModel
Response model for intent submission.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gunn.adapters.web.server.ObservationResponse(**data)[ソース]¶
ベースクラス:
BaseModel
Response model for observation requests.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gunn.adapters.web.server.ErrorResponse(**data)[ソース]¶
ベースクラス:
BaseModel
Error response model.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gunn.adapters.web.server.RateLimiter(max_requests=100, window_seconds=60)[ソース]¶
ベースクラス:
object
Simple in-memory rate limiter.
- class gunn.adapters.web.server.WebAdapter(orchestrator, auth_tokens=None, rate_limit_requests=100, rate_limit_window=60)[ソース]¶
ベースクラス:
object
FastAPI-based Web adapter for external integration.
- パラメータ:
- add_auth_token(token, world_id, agent_id, permissions, expires_at=None)[ソース]¶
Add authentication token.
- 戻り値の型:
- パラメータ:
- Args:
token: Authentication token world_id: World ID this token is valid for agent_id: Agent ID this token is valid for permissions: List of permissions expires_at: Optional expiration timestamp
- gunn.adapters.web.server.create_web_adapter(orchestrator, auth_tokens=None, rate_limit_requests=100, rate_limit_window=60)[ソース]¶
Create a Web adapter instance.
- 戻り値の型:
- パラメータ:
- Args:
orchestrator: Orchestrator instance auth_tokens: Authentication tokens mapping rate_limit_requests: Rate limit requests per window rate_limit_window: Rate limit window in seconds
- Returns:
WebAdapter instance
Module contents¶
Web adapter for REST and WebSocket endpoints.
This module provides FastAPI-based REST and WebSocket endpoints for external system integration with authentication, authorization, and rate limiting.
- class gunn.adapters.web.AuthToken(**data)[ソース]¶
ベースクラス:
BaseModel
Authentication token with permissions.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gunn.adapters.web.ErrorResponse(**data)[ソース]¶
ベースクラス:
BaseModel
Error response model.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gunn.adapters.web.IntentRequest(**data)[ソース]¶
ベースクラス:
BaseModel
Request model for intent submission.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gunn.adapters.web.IntentResponse(**data)[ソース]¶
ベースクラス:
BaseModel
Response model for intent submission.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gunn.adapters.web.ObservationResponse(**data)[ソース]¶
ベースクラス:
BaseModel
Response model for observation requests.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gunn.adapters.web.WebAdapter(orchestrator, auth_tokens=None, rate_limit_requests=100, rate_limit_window=60)[ソース]¶
ベースクラス:
object
FastAPI-based Web adapter for external integration.
- パラメータ:
- add_auth_token(token, world_id, agent_id, permissions, expires_at=None)[ソース]¶
Add authentication token.
- 戻り値の型:
- パラメータ:
- Args:
token: Authentication token world_id: World ID this token is valid for agent_id: Agent ID this token is valid for permissions: List of permissions expires_at: Optional expiration timestamp
- gunn.adapters.web.create_web_adapter(orchestrator, auth_tokens=None, rate_limit_requests=100, rate_limit_window=60)[ソース]¶
Create a Web adapter instance.
- 戻り値の型:
- パラメータ:
- Args:
orchestrator: Orchestrator instance auth_tokens: Authentication tokens mapping rate_limit_requests: Rate limit requests per window rate_limit_window: Rate limit window in seconds
- Returns:
WebAdapter instance