-
Notifications
You must be signed in to change notification settings - Fork 2
refactor: Restructure bot into modular agent with multi-provider LLM support #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nalbam
wants to merge
66
commits into
awskrug:main
Choose a base branch
from
nalbam:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
0a44540
refactor: Update inference configuration comments and remove TopP and…
nalbam ac985fb
Add logging utilities, Slack helpers, and tool registry with built-in…
nalbam 10e0784
refactor: Update AWS role policy and streamline deployment workflow
nalbam af6bca3
fix: Update role-to-assume in AWS credentials configuration for deplo…
nalbam a9aea20
Add unit tests for logging utilities, Slack helpers, and tool functio…
nalbam 328a16f
docs: Add missing image for Gurumi Bot in README
nalbam cca9f5d
feat: Add permissions for API Gateway tags in role policy
nalbam 24ba902
refactor: Rename job from 'test-and-deploy' to 'deploy' in workflow c…
nalbam d1e04c4
chore: Update action versions and enhance step descriptions in workfl…
nalbam 82447cb
docs: Update CLAUDE.md and README.md for clarity and workflow details
nalbam 875035f
Update README.md
nalbam 165d886
refactor: Remove path instructions from review configuration
nalbam 0e385a3
feat(config): add web-fetch settings (MAX_WEB_CHARS/BYTES/LINKS, JINA…
nalbam 03d51bf
test(config): drop redundant delenv loop in test_web_fetch_defaults
nalbam 9bc676c
feat(tools): add SSRF guard and no-redirect handler for web fetch
nalbam 302f143
fix(tools): strengthen SSRF guard (empty DNS, CGNAT, gaierror test)
nalbam 3aeb526
feat(tools): add HTML extractor and Jina response parser for web fetch
nalbam 3846fb0
fix(tools): harden Jina/HTML parsers (inline body, balanced parens, h…
nalbam ab5c449
feat(tools): add Jina Reader + direct-GET fetchers with size guards
nalbam a1e31c8
refactor(tools): extract web fetch timeout constant and annotate noqa
nalbam 7ad31fb
refactor(tools): split web-fetch helpers into src/tools_web.py
nalbam cf82880
feat(tools): add fetch_webpage tool with Jina+raw fallback
nalbam 6dc01cc
refactor(tools): clarify fetch_webpage fallback flow and demote jina-…
nalbam b1207fa
docs: document fetch_webpage env vars and SSRF gating
nalbam 76410e1
fix(tools): document DNS rebinding, clarify except order, validate JI…
nalbam 3d1f220
refactor(llms): split src/llm.py into src/llms package
nalbam 2a07249
refactor(llms): drop unused imports introduced by the package split
nalbam 9102a88
refactor(tests): split tests/test_llm.py into tests/llms package
nalbam 1658246
refactor(tests): hoist inline json/base64 imports to module level
nalbam c8a3ff9
refactor(tests): hoist inline base64 import in test_xai
nalbam 8d23d51
refactor(tools): split src/tools.py and src/tools_web.py into src/too…
nalbam 2f33871
refactor(tools): use relative side-effect imports and note time.py st…
nalbam 9d22f0d
refactor(tests): split tests/test_tools.py into tests/tools package
nalbam 1e2e2f9
refactor(tests): drop unused imports in tests/tools after split
nalbam 92294bf
docs: update module paths and document extension points
nalbam e3bca27
refactor(tests): drop empty llms test stubs
nalbam fd30c99
docs: refresh README and add extension guide
nalbam a316f8e
fix: add newline before response indication in step output
nalbam ef8e318
docs: sync CLAUDE.md + extending guide with current code
nalbam 5c3a600
chore(deploy): wire MAX_WEB_*/JINA_READER_BASE and MAX_DOC_*/DEFAULT_…
nalbam d36faa7
chore(deploy): align env order across push.yml and serverless.yml (se…
nalbam cda6b5f
chore: add stackTags and tags for katalog_id in serverless.yml
nalbam f0ce062
feat: enhance UserNameCache with thread-safe warm method and parallel…
nalbam 194a894
fix: route Bedrock Nova vision through Converse API
nalbam 2c93727
fix: close ToolExecutor pool and catch provider exceptions
nalbam 373dd7b
fix: recover stream on chat_update failures and redact more tokens
nalbam dcac908
perf: make ConversationStore.truncate_to_chars single-pass
nalbam b722980
fix: bypass channel allowlist for DMs and drop empty mentions early
nalbam f51de64
chore: drop unused AWS_REGION_NAME from Lambda env
nalbam 2af0874
docs: sync test counts, coverage, and new invariants
nalbam 7d9f04d
feat: layer system prompt and harden its guidance
nalbam bb32da9
feat: add additional API Gateway permissions for policy management
nalbam b554c77
chore: update AWS credentials action to v6 in workflow files
nalbam fc4eaa2
chore: raise Lambda and image tool timeouts
nalbam 01041c6
refactor: split Lambda into receiver/worker paths
nalbam 5c7b304
feat: configure Bedrock client with explicit timeout and retry settings
nalbam 6a591f0
feat: add error handling for Slack API message length limits in Strea…
nalbam dc48b06
feat: update default allowed channel message for user guidance
nalbam a1aada3
feat: implement channel message substitution for blocked channels
nalbam 075027b
feat: add user allowlist functionality with customizable messages for…
nalbam 4a6c7ea
Merge pull request #12 from nalbam/feat/access-control
nalbam b3b4516
fix: prevent duplicate prefix in streaming reply after roll-finalize
nalbam 3f6f477
fix: split messages on paragraph boundary, fence-aware code blocks
nalbam 8f1e54b
fix: fall back to single \n when splitting code blocks and lists
nalbam 7b6f99d
fix: balance code-fence on streaming roll-finalize
nalbam 78bcc5e
fix: cut streaming roll at last newline, not mid-token
nalbam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,54 @@ | ||
| BOT_CURSOR=":loading:" | ||
| # --- Slack (required at runtime) --- | ||
| SLACK_BOT_TOKEN="xoxb-your-slack-bot-token" | ||
| SLACK_SIGNING_SECRET="your-slack-signing-secret" | ||
|
|
||
| SLACK_BOT_TOKEN="xoxb-xxxx" | ||
| SLACK_SIGNING_SECRET="xxxx" | ||
| # --- LLM / text (default: openai / gpt-4o-mini) --- | ||
| LLM_PROVIDER="openai" # openai | bedrock | xai | ||
| LLM_MODEL="gpt-4o-mini" # OpenAI: gpt-4o-mini / gpt-5 / o3 | Bedrock: us.anthropic.claude-opus-4-6-v1 / amazon.nova-pro-v1:0 | xAI: grok-4-1-fast-reasoning / grok-4.20-0309-reasoning | ||
|
|
||
| ALLOWED_CHANNEL_IDS="C000000,C000001" | ||
| ALLOWED_CHANNEL_MESSAGE="구루미에게 질문은 {} 채널을 이용해 주세요~" | ||
| # --- Image generation (default: openai / gpt-image-1) --- | ||
| IMAGE_PROVIDER="openai" # openai | bedrock | xai | ||
| IMAGE_MODEL="gpt-image-1" # OpenAI: gpt-image-1 / dall-e-3 | Bedrock: amazon.nova-canvas-v1:0 / amazon.titan-image-generator-v2:0 | xAI: grok-imagine-image / grok-imagine-image-pro | ||
|
|
||
| PERSONAL_MESSAGE="너는 AWSKRUG(AWS Korea User Group)의 친절하고 전문적인 AI 비서 구루미(Gurumi)야." | ||
| SYSTEM_MESSAGE="참고한 링크가 있다면 링크도 알려주세요. 한국어로 응답해주세요." | ||
| # --- Providers (required by provider in use) --- | ||
| OPENAI_API_KEY="sk-your-openai-api-key" | ||
| XAI_API_KEY="" # required when LLM_PROVIDER=xai or IMAGE_PROVIDER=xai. Get at https://console.x.ai | ||
| TAVILY_API_KEY="" # optional, enables richer web search | ||
|
|
||
| REACTION_EMOJIS="refund-done" | ||
| # --- Agent behavior --- | ||
| AGENT_MAX_STEPS=3 | ||
| MAX_OUTPUT_TOKENS=4096 # per-LLM-hop output token cap (>=256) | ||
| RESPONSE_LANGUAGE="ko" # ko | en | ||
|
|
||
| # --- Slack UX --- | ||
| BOT_CURSOR=":robot_face:" | ||
| MAX_LEN_SLACK=3000 # per-message character cap, >=500 | ||
| SYSTEM_MESSAGE="" # optional extra operator policy appended to task rules | ||
| PERSONA_MESSAGE="" # optional answer style / tone (e.g. "자연스러운 한국어로 핵심부터 답한다") | ||
|
|
||
| # --- Access control / throttle --- | ||
| ALLOWED_CHANNEL_IDS="" # comma-separated channel IDs, empty = allow all | ||
| ALLOWED_CHANNEL_MESSAGE="" # reply sent when channel not allowed; "{}" → first allowed channel | ||
| ALLOWED_USER_IDS="" # comma-separated user IDs, empty = allow all (applies to DMs too) | ||
| ALLOWED_USER_MESSAGE="" # reply sent when user not allowed; "{}" → first allowed user | ||
| MAX_THROTTLE_COUNT=100 # per-user active request cap | ||
|
|
||
| # --- Storage (DynamoDB — created by serverless deploy) --- | ||
| DYNAMODB_TABLE_NAME="lambda-gurumi-bot-dev" | ||
| MAX_HISTORY_CHARS=4000 | ||
| AWS_REGION="us-east-1" | ||
|
|
||
| # --- Observability --- | ||
| LOG_LEVEL="INFO" | ||
|
|
||
| # --- Document / time --- | ||
| DEFAULT_TIMEZONE="Asia/Seoul" # IANA TZ for get_current_time default | ||
| MAX_DOC_CHARS=20000 # per-document extracted-text cap (>=1000) | ||
| MAX_DOC_PAGES=50 # per-document PDF page cap (>=1) | ||
| MAX_DOC_BYTES=26214400 # per-document download cap, 25MB (>=65536) | ||
|
|
||
| # --- Web fetch (fetch_webpage tool) --- | ||
| MAX_WEB_CHARS=8000 # per-fetch returned content char cap (>=500) | ||
| MAX_WEB_BYTES=2097152 # per-fetch download cap, 2MB (>=65536) | ||
| MAX_WEB_LINKS=20 # per-fetch outbound-link cap (>=0) | ||
| JINA_READER_BASE="https://r.jina.ai" # override for self-hosted Jina Reader |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.